package pl.edu.agh.experts.diseases.gui;

import java.awt.Container;
import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;

import pl.edu.agh.experts.diseases.QuestionStrategy;

public class SetupWindow extends JFrame {

	JComboBox combo;

	public SetupWindow() {
		super("Setup");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		Container container = getContentPane();
		container.setLayout(new GridLayout(6, 2));

		combo = new JComboBox();
		for (QuestionStrategy str : QuestionStrategy.values()) {
			combo.addItem(str);
		}

		container.add(new JLabel(""));
		container.add(new JLabel(""));

		container.add(new JLabel("Wybierz sposób wybierania pytań: "));
		container.add(combo);

		container.add(new JLabel(""));
		container.add(new JLabel(""));

		container
				.add(new JLabel(
						"Wybierz wagę dla której system powinien zakończyć zadawanie pytań (od 5 do 100): "));
		JSpinner spinner = new JSpinner(new SpinnerNumberModel(85, 5, 100, 5));
		container.add(spinner);

		container.add(new JLabel(""));
		container.add(new JLabel(""));

		container.add(new JLabel(""));
		JButton okButton = new JButton("OK");
		container.add(okButton);
		
		okButton.addActionListener(new SetupWindowListener(combo, spinner, this));

		pack();
		setVisible(true);
	}

}
